package com.jcl.recruit.resume.logic;

import com.jcl.core.utils.CollectionUtils;
import com.jcl.recruit.resume.mapper.ResumeJobIntentionMapper;
import com.jcl.recruit.resume.model.ResumeJobIntention;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName ResumeJobIntentionLogic
 * @Description TODO
 * @Author yyliu
 * @Date 2018/11/17 11:51
 * @Version 1.0
 **/
@Component
public class ResumeJobIntentionLogic implements ResumeJobIntentionMapper {

    @Autowired
    ResumeJobIntentionMapper resumeJobIntentionMapper;

    public Map<Integer, ResumeJobIntention> findEntityMapByResumeIds(String corpCode, List<Integer> resumeIds) {
        Map<Integer, ResumeJobIntention> dataMap = new HashMap<>();
        List<ResumeJobIntention> list = resumeJobIntentionMapper.findListByResumeIds(corpCode, resumeIds);
        if (CollectionUtils.isNotEmpty(list)) {
            for (ResumeJobIntention entity : list) {
                dataMap.put(entity.getResumeId(), entity);
            }
        }

        return dataMap;
    }

    @Override
    public List<ResumeJobIntention> findListByResumeIds(String corpCode, List<Integer> resumeIds) {
        return resumeJobIntentionMapper.findListByResumeIds(corpCode, resumeIds);
    }

    @Override
    public Map<String, Object> findOneMap(String corpCode, Integer resumeId) {
        return resumeJobIntentionMapper.findOneMap(corpCode, resumeId);
    }

    @Override
    public ResumeJobIntention findOne(String corpCode, Integer resumeId) {
        return resumeJobIntentionMapper.findOne(corpCode, resumeId);
    }

    @Override
    public int add(ResumeJobIntention entity) {
        return resumeJobIntentionMapper.add(entity);
    }

    @Override
    public int batchDeleteByResumeIds(String corpCode, List<Integer> resumeIds) {
        return resumeJobIntentionMapper.batchDeleteByResumeIds(corpCode, resumeIds);
    }
}
